package com.tboss.template.common.springSecurity;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import com.tboss.global.helpers.sqlSession.SqlSessionSupport;
import com.tboss.template.system.dto.GroupDto;
import com.tboss.template.system.dto.MapGrpFnDto;
import com.tboss.template.system.dto.RoleDto;

@Repository
public class SecurityUserDao extends SqlSessionSupport {

	@Autowired
	public SecurityUserDao(@Qualifier("sqlSession")SqlSession sqlSession){
		super(sqlSession);
	}
	
	@Override
	public String getNameSpace() {
		return "security";
	}
	
	public SecurityUserDto getInfo(String username){
		return super.queryForObject("chkUser", username);
	}
	
	public List<GroupDto> getGroups(String username){
		return super.queryForList("getGroups", username);
	}
	
	public List<RoleDto> getRoles(String username){
		return super.queryForList("getRoles", username);
	}

	public List<MapGrpFnDto> getMyMenu(String username){
		return super.queryForList("getMyMenu", username);
	}
	
	public void initGrpChgChkField(String usrId){
		super.queryForObject("initGrpChgChkField", usrId);
	}
	
}
